<script src="../js/getDate.js"></script>
<footer>
    <button id='time-btn' style='position: fixed; bottom: 15px; right: 120px; border: groove;'>隐藏时间</button>
    <p id='time' style='position: fixed; bottom: 0; right: 0;'>
        当前时间:<br/>
        <span id="time-show"></span>
    </p>
    <script>
        function setTime() {
            document.getElementById("time-show").innerHTML = date().toString();
        }

        setTime();
        setInterval(setTime, 1000);

        function changeTime() {
            const timeParagraph = document.querySelector('p#time');
            const timeButton = document.getElementById('time-btn');
            if (timeParagraph.style.display === 'none') {
                timeParagraph.style.display = 'block';
                timeButton.textContent = '隐藏时间';
            } else {
                timeParagraph.style.display = 'none';
                timeButton.textContent = "显示时间";
                timeButton.style.display = 'none';
            }
        }

        document.getElementById('time-btn').addEventListener('click', function () {
            changeTime();
            if (this.style.display === 'none') {
                this.style.display = 'block';
            }
        });
    </script>
</footer>